<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/5/27
 * Time: 14:55
 */

namespace app\index\controller;


use think\Controller;

class Article extends Controller
{
    private $obj;
    public function _initialize()
    {
        $this -> obj = model('Article');
    }
    public function detail($id=0)
    {
        if ($id <1){
            $this -> error('参数错误');
        }

        $articles = model('Article') -> getNormalArticles();


        //获取相关信息
        $article = $this -> obj ->getDetail($id);

        if ($article){
            return $this -> fetch('',[
                'article' => $article,
                'articles' => $articles
            ]);
        }

    }

}